/* Start Header **************************************************************/
/*!
\file Vector2D.h
\author David Seah Seng Chong, sengchong.seah, 250004910
\par email: sengchong.seah@digipen.edu
\date 20 July 2011
\brief 

Copyright (C) 2011 DigiPen Institute of Technology.
Reproduction or disclosure of this file or its contents
without the prior written consent of DigiPen Institute of
Technology is prohibited.
*/
/* End Header ****************************************************************/

#ifndef CS230_VECTOR2D_H_
#define CS230_VECTOR2D_H_

	
	#ifdef _MSC_VER
	// Supress warning: nonstandard extension used : nameless struct/union
	#pragma warning( disable : 4201 )
	#endif

	typedef union Vector2D
	{
		struct
		{
			float x, y;
		};

		float m_coords[2];

		// Constructors
		Vector2D() {};
		Vector2D(float _x, float _y);

		// Assignment operators
		Vector2D& operator += (const Vector2D &rhs);
		Vector2D& operator -= (const Vector2D &rhs);
		Vector2D& operator *= (float rhs);
		Vector2D& operator /= (float rhs);

		// Unary operators
		Vector2D operator -() const;

	} Vector2D, Vec2, Point2D, Pt2;


	#ifdef _MSC_VER
	// Supress warning: nonstandard extension used : nameless struct/union
	#pragma warning( default : 4201 )
	#endif

	// Binary operators
	Vector2D operator + (const Vector2D &lhs, const Vector2D &rhs);
	Vector2D operator - (const Vector2D &lhs, const Vector2D &rhs);
	Vector2D operator * (const Vector2D &lhs, float rhs);
	Vector2D operator * (float lhs, const Vector2D &rhs);
	Vector2D operator / (const Vector2D &lhs, float rhs);
	Vector2D operator / (float lhs, const Vector2D &rhs);

	void	Vector2DNormalize(Vector2D &pResult, const Vector2D &pVec0);
	float	Vector2DLength(const Vector2D &pVec0);
	float	Vector2DSquareLength(const Vector2D &pVec0);
	float	Vector2DDistance(const Vector2D &pVec0, const Vector2D &pVec1);
	float	Vector2DSquareDistance(const Vector2D &pVec0, const Vector2D &pVec1);
	float	Vector2DDotProduct(const Vector2D &pVec0, const Vector2D &pVec1);
	float	Vector2DCrossProductMag(const Vector2D &pVec0, const Vector2D &pVec1);


#endif // CS230_VECTOR2D_H_